import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/recommend'
  },
  {
    path: '/recommend',
    name: '推荐',
    component: () => import('@/views/recommend/index.vue')
  },
  {
    path: '/singer',
    name: '歌手',
    component: () => import('@/views/singer/index.vue'),
    children: [
      {
        path: ':id',
        component: () => import('@/views/song/index.vue')
      }
    ]
  },
  {
    path: '/top-list',
    name: '排行',
    component: () => import('@/views/top-list/index.vue')
  },
  {
    path: '/search',
    name: '搜索',
    component: () => import('@/views/search/index.vue')
  }
  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
